package com.ruoyi.system.utils;

import cn.hutool.captcha.CaptchaUtil;
import cn.hutool.captcha.ShearCaptcha;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.concurrent.TimeUnit;

@Component
public class EmailUtil {
    @Value("${spring.mail.username}")
     String formMail;
    @Autowired
    JavaMailSender javaMailSender;
    @Autowired
    RedisTemplate redisTemplate;


    /**
     * 发送验证码
     * @param email
     */
    public  void sendEmail(String email,String msg){
        SimpleMailMessage message = new SimpleMailMessage();
        message.setSubject("您的密码是");
        message.setFrom(formMail);
        message.setTo(email);
        message.setText(msg);//验证码
        javaMailSender.send(message);//邮箱发送一份
    }
}

